import { request } from '../utils/request';
import type { ResearchAnalysis, ResearchQuery } from '../types/research';
import type { ApiResponse } from '../types/common';

export const researchApi = {
  // 获取研究分析数据
  getResearchAnalysis: (params: ResearchQuery) => 
    request.get<ApiResponse<ResearchAnalysis>>('/api/research/analysis', { params }),

  // 获取热点聚类
  getResearchClusters: (params: ResearchQuery) => 
    request.get<ApiResponse<ResearchAnalysis['clusters']>>('/api/research/clusters', { params }),

  // 获取地域分布
  getResearchHeatmap: (params: ResearchQuery) => 
    request.get<ApiResponse<ResearchAnalysis['heatmap']>>('/api/research/heatmap', { params }),

  // 获取机构排名
  getTopInstitutions: (params: ResearchQuery) => 
    request.get<ApiResponse<ResearchAnalysis['institutions']>>('/api/research/institutions', { params }),

  // 获取研究人员排名
  getTopResearchers: (params: ResearchQuery) => 
    request.get<ApiResponse<ResearchAnalysis['researchers']>>('/api/research/researchers', { params }),

  // 导出分析报告
  exportAnalysisReport: (params: ResearchQuery) => 
    request.get('/api/research/export', {
      params,
      responseType: 'blob'
    }),
}; 